Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Bitfinex support #162

Closed
wants to merge 20 commits into from
Closed

Bitfinex support #162

wants to merge 20 commits into from

Conversation

nedievas
Copy link
Contributor

added needed files. Some functions work. I hope for community help to finish it faster.

@nedievas
Copy link
Contributor Author

Completed.
Test:

[bfxbot@gene zenbot]$ ./zenbot.sh list-selectors

bitfinex:
  bitfinex.BCC-BTC   (BCC/BTC)
  bitfinex.BCC-USD   (BCC/USD)
  bitfinex.BCU-BTC   (BCU/BTC)
  bitfinex.BCU-USD   (BCU/USD)
  bitfinex.BTC-USD   (BTC/USD)
  bitfinex.DSH-BTC   (DSH/BTC)
  bitfinex.DSH-USD   (DSH/USD)
  bitfinex.ETC-BTC   (ETC/BTC)
  bitfinex.ETC-USD   (ETC/USD)
  bitfinex.ETH-BTC   (ETH/BTC)
  bitfinex.ETH-USD   (ETH/USD)
  bitfinex.LTC-BTC   (LTC/BTC)
  bitfinex.LTC-USD   (LTC/USD)
  bitfinex.RRT-BTC   (RRT/BTC)
  bitfinex.RRT-USD   (RRT/USD)
  bitfinex.XMR-BTC   (XMR/BTC)
  bitfinex.XMR-USD   (XMR/USD)
  bitfinex.XRP-BTC   (XRP/BTC)
  bitfinex.XRP-USD   (XRP/USD)
  bitfinex.ZEC-BTC   (ZEC/BTC)
  bitfinex.ZEC-USD   (ZEC/USD)

[bfxbot@gene zenbot]$ ./zenbot.sh backfill bitfinex.btc-usd
cannot backfill bitfinex.BTC-USD: exchange does not offer historical data

[bfxbot@gene zenbot]$ ./zenbot.sh sim bitfinex.btc-usd
2017-05-21 08:00:00    2069.20 USD              647                               0.00000 BTC  1000.00 USD    +0.0%   -1.1%
{ strategy: 'trend_ema',
  sell_stop_pct: 0,
  buy_stop_pct: 0,
  profit_stop_enable_pct: 0,
  profit_stop_pct: 1,
  max_slippage_pct: 5,
  buy_pct: 99,
  sell_pct: 99,
  order_adjust_time: 30000,
  max_sell_loss_pct: 25,
  markup_pct: 0,
  days: 90,
  currency_capital: 1000,
  asset_capital: 0,
  rsi_periods: 14,
  start: 1487548800000,
  stats: false,
  selector: 'bitfinex.BTC-USD',
  mode: 'sim',
  period: '1h',
  min_periods: 36,
  trend_ema: 34,
  buy_rate: 0,
  sell_rate: 0,
  max_buy_duration: 1,
  max_sell_duration: 1,
  oversold_rsi_periods: 14,
  oversold_rsi: 0 }
end balance 1000.00000000 (0.00%)
buy hold 1010.36168133 (1.04%)
vs. buy hold -1.03%
0 trades over 0 days (avg NaN trades/day)
wrote sim_result.html

[bfxbot@gene zenbot]$ ./zenbot.sh trade --paper  bitfinex.btc-usd
fetching pre-roll data:
cannot backfill bitfinex.BTC-USD: exchange does not offer historical data
               DATE            PRICE     DIFF            VOL         RSI                         ACTIONS                      BAL                PROFIT
2017-05-21 08:00:00    2069.20 USD              647
---------------------------- STARTING PAPER TRADING ----------------------------
2017-05-21 09:00:00    2067.10 USD   -0.1%      667                               0.00000 BTC  1000.00 USD    +0.0%   +0.1%
2017-05-21 09:01:17    2067.10 USD   +0.0%        2                               0.00000 BTC  1000.00 USD    +0.0%   +0.1%

[bfxbot@gene zenbot]$ ./zenbot.sh trade  bitfinex.btc-usd
fetching pre-roll data:
cannot backfill bitfinex.BTC-USD: exchange does not offer historical data
               DATE            PRICE     DIFF            VOL         RSI                         ACTIONS                      BAL                PROFIT
2017-05-21 08:00:00    2069.20 USD              647
2017-05-21 09:00:00    2067.10 USD   -0.1%      334
---------------------------- STARTING LIVE TRADING ----------------------------
BTC-USD BTCUSD
2017-05-21 09:03:25    2067.10 USD   +0.0%        5                               0.00000 BTC  72.96 USD    +0.0%   +0.0%

[bfxbot@gene zenbot]$ ./zenbot.sh buy --size 0.1 bitfinex.btc-usd

buy delayed: +99.3% of funds (72.44 USD) on hold
placing order...

@carlos8f
Copy link
Contributor

nice :D I will try to test it soon. Note that recently I moved the extension confs into the main conf, thus the conflict.

For backfilling, I wonder if we can use https://cryptowat.ch/ for that.

@nedievas
Copy link
Contributor Author

I also moved conf to main, so is the write access conflict. Updated everything to the last version.

simple code to buy and sell. Not tested via zenbot, only separately.
@DeviaVir DeviaVir mentioned this pull request May 23, 2017
have some issue with order status return.

/home/rebootfin/zenbot/commands/buy.js:48
              console.log('order status: '.grey + s.api_order.status.green + ', bid: '.grey + n(s.api_order.price).format('0.00000000').yellow + ', '.grey + n(quote.bid).subtract(s.api_order.pric
e).format('0.00000000').red + ' below best bid, '.grey + n(s.api_order.filled_size).divide(s.api_order.size).format('0.0%').green + ' filled'.grey)
                                                                    ^
TypeError: Cannot read property 'green' of undefined
    at /home/rebootfin/zenbot/commands/buy.js:48:69
    at /home/rebootfin/zenbot/extensions/bitfinex/exchange.js:106:9
@nedievas
Copy link
Contributor Author

Now may buy and sell, though we have order status error:

/home/rebootfin/zenbot/commands/buy.js:48
              console.log('order status: '.grey + s.api_order.status.green + ', bid: '.grey + n(s.api_order.price).format('0.00000000').yellow + ', '.grey + n(quote.bid).subtract(s.api_order.pric
e).format('0.00000000').red + ' below best bid, '.grey + n(s.api_order.filled_size).divide(s.api_order.size).format('0.0%').green + ' filled'.grey)
                                                                    ^
TypeError: Cannot read property 'green' of undefined
    at /home/rebootfin/zenbot/commands/buy.js:48:69
    at /home/rebootfin/zenbot/extensions/bitfinex/exchange.js:106:9

unnecessary: cancel_all_orders
@nedievas
Copy link
Contributor Author

moving to separate extension repo

@nedievas nedievas closed this May 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants